<template>
    <div class="app-container">
        <el-row :gutter="20">
            <!--部门数据-->
            <el-col :span="4" :xs="24">
                <fileTrees @handleNodeClick="onTreeClick" :tableHeight="treeHeight" :isnoClick="isnoClick" :menuId="menuId">
                </fileTrees>
            </el-col>
            <!--离线接收数据-->
            <el-col :span="20" :xs="24" v-show="isShow">
                <queryCriteriaList v-if="listFrom.length > 0" :showSearch="showSearch" :listFrom="listFrom"
                    @resetQuery="resetQuery" @handleQuery="handleQuery" ref="queryForm"></queryCriteriaList>
                <el-row :gutter="10" class="mb8" ref="refbut">
                    <!-- <el-col :span="1.5" v-if="subStr == 'X' && categoryType == '3'">
                        <el-button type="primary" plain icon="el-icon-takeaway-box"
                            @click="handleQuXiaoJieshouTap()"
                                    v-hasPermi="['archive:wjzl:cancelAccept']"
                        >取消接收</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'V' && categoryType == '1'">
                        <el-button type="primary" plain icon="el-icon-takeaway-box"
                            @click="handleQuXiaoJieshouTap()"
                                    v-hasPermi="['archive:wjzl:cancelAccept']"
                        >取消接收</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'F' && categoryType == '0'">
                        <el-button type="primary" plain icon="el-icon-takeaway-box"
                            @click="handleQuXiaoJieshouTap()"
                                    v-hasPermi="['archive:wjzl:cancelAccept']"
                        >取消接收</el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button type="success" plain icon="el-icon-edit"  v-if="subStr == 'X'"
                            @click="handledeitTap(1)" v-hasPermi="['archive:lxjs:updateItem']">修改</el-button>
                      <el-button type="success" plain icon="el-icon-edit"  v-if="subStr == 'V'"
                                 @click="handledeitTap(1)" v-hasPermi="['archive:lxjs:updateFolder']">修改</el-button>
                      <el-button type="success" plain icon="el-icon-edit"  v-if="subStr == 'F'"
                                 @click="handledeitTap(1)" v-hasPermi="['archive:lxjs:updateYqda']">修改</el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button type="danger" plain icon="el-icon-delete"   v-if="subStr == 'X'"
                            @click="handleDeleteTap()"
                                   v-hasPermi="['archive:wjzl:delete']"
                        >删除</el-button>
                      <el-button type="danger" plain icon="el-icon-delete"   v-if="subStr == 'V'"
                                 @click="handleDeleteTap()" v-hasPermi="['archive:wjzl:delete']"
                      >删除</el-button>
                      <el-button type="danger" plain icon="el-icon-delete"   v-if="subStr == 'F'"
                                 @click="handleDeleteTap()" v-hasPermi="['archive:wjzl:delete']"
                      >删除</el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button type="warning" plain icon="el-icon-printer"
                            @click="print1Tap" v-hasPermi="['archive:wjzl:mldy']">目录打印</el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button type="info" plain icon="el-icon-download"
                            @click="handleExport" v-hasPermi="['archive:wjzl:export']">导出</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'X' && categoryType == '3'">
                        <el-button type="primary" plain icon="el-icon-plus"
                            @click="handleJieshouTap()" v-hasPermi="['archive:fileCollection:archiveApproval:applicationForm:add']">归档申请单</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'V' && categoryType == '1'">
                        <el-button type="primary" plain icon="el-icon-plus"
                            @click="handleJieshouTap()" v-hasPermi="['archive:fileCollection:archiveApproval:applicationForm:add']">归档申请单</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'F' && categoryType == '0'">
                        <el-button type="primary" plain icon="el-icon-plus"
                            @click="handleJieshouTap()" v-hasPermi="['archive:fileCollection:archiveApproval:applicationForm:add']">归档申请单</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'V' || subStr == 'F'">
                        <el-button type="primary" plain icon="el-icon-plus"
                            @click="handleGuidanceTap()"
                                    v-hasPermi="['archive:supervisionDa']">添加到指导单</el-button>
                    </el-col> -->
                    <!-- <el-col :span="1.5">
                        <el-button type="info" plain icon="el-icon-download" >下载模板</el-button>
                    </el-col> -->


                    <el-col :span="1.5" v-show="subStr == 'X' && categoryType == '3'">
                        <el-button type="primary" plain icon="el-icon-plus" @click="handleguidangJieshouTap(0)"
                            v-hasPermi="['archive:fileCollection:fileOrganization:fileOrganizationTobeArchive:add']">归档接收</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V' && categoryType == '1'">
                        <el-button type="primary" plain icon="el-icon-plus" @click="handleguidangJieshouTap(0)"
                            v-hasPermi="['archive:fileCollection:fileOrganization:fileOrganizationTobeArchive:add']">归档接收</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'F' && categoryType == '0'">
                        <el-button type="primary" plain icon="el-icon-plus" @click="handleguidangJieshouTap(0)"
                            v-hasPermi="['archive:fileCollection:fileOrganization:fileOrganizationTobeArchive:add']">归档接收</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'X'">
                        <el-button type="primary" plain icon="el-icon-printer" @click="handledeitanJuanTap()"
                            v-hasPermi="['archive:lxjs:addFolderDgd']">案卷著录</el-button>
                    </el-col>

                    <el-col :span="1.5" v-show="subStr == 'X'">
                        <el-button type="primary" plain icon="el-icon-printer" @click="handledeitanDeitJuanTap()"
                            v-hasPermi="['archive:lxjs:updateFolderDgd']">案卷修改</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="(subStr == 'X')">
                        <!--项目修改-->
                        <el-button type="success" plain icon="el-icon-edit" @click="handledeitTap(1)"
                            v-hasPermi="['archive:dgd:updateItem']">修改</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="(subStr == 'V')">
                        <!--案卷修改-->
                        <el-button type="success" plain icon="el-icon-edit" @click="handledeitTap(1)"
                            v-hasPermi="['archive:dgd:updateFolder']">修改</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="(subStr == 'F')">
                        <!--件修改-->
                        <el-button type="success" plain icon="el-icon-edit" @click="handledeitTap(1)"
                            v-hasPermi="['archive:dgd:updateYqda']">修改</el-button>

                    </el-col>
                    <el-col :span="1.5" v-show="(subStr == 'V')">
                        <el-button type="danger" plain icon="el-icon-delete" @click="handleDeleteTap('2')"
                            v-hasPermi="['archive:dgd:deleteFolder']">删除</el-button>
                    </el-col>
                    <el-col :span="1.5"
                        v-show="(subStr == 'X' && categoryType == '3') || (subStr == 'V' && categoryType == '1') || (subStr == 'F' && categoryType == '0')">
                        <el-button type="danger" plain icon="el-icon-takeaway-box" @click="tuihuiTap"
                            v-hasPermi="['archive:ygd:tuihui']">退回</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V' || subStr == 'F'">
                        <el-button type="primary" icon="el-icon-files" @click="rowNumber"
                            v-hasPermi="['archive:ygd:pieceNumber']">{{ subStr == 'F' ?
                                '排件号' : '排卷号'
                            }}</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V' || subStr == 'F'">
                        <el-button type="primary" icon="el-icon-files" @click="cleanUp"
                            v-hasPermi="['archive:ygd:clearNumber']">{{ subStr == 'F' ?
                                '清空件号' : '清空卷号'
                            }}</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V' || subStr == 'F'">
                        <el-button type="primary" icon="el-icon-files" @click="manualNumber"
                            v-hasPermi="['archive:ygd:insertPieceNumber']">{{ subStr == 'F' ?
                                '手动排件号' : '手动排卷号'
                            }}</el-button>
                    </el-col>
                    <el-col :span="1.5"
                        v-show="(subStr == 'V' && categoryType == 1) || (subStr == 'V' && categoryType == 3)">
                        <el-button type="warning" plain icon="el-icon-files" @click="mergeYqdaTap(2)"
                            v-hasPermi="['archive:ygd:assemblyFolder']">合并册</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V' && (categoryType == '1' || categoryType == '3')">
                        <el-button type="success" plain icon="el-icon-s-claim"
                            v-hasPermi="['archive:wjzl:dhOfCheckForDefects']" @click="leakFilling">档号查缺</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'F' && categoryType == '0'">
                        <el-button type="success" plain icon="el-icon-s-claim"
                            v-hasPermi="['archive:wjzl:dhOfCheckForDefects']" @click="leakFilling">档号查缺</el-button>
                    </el-col>

                    <el-col :span="1.5" v-show="subStr == 'V' || subStr == 'F'">
                        <!-- v-hasPermi="['archive:lxjs:updateBgqx']" -->
                        <el-button type="primary" plain icon="el-icon-plus" @click="deitBGQXTap"
                            v-hasPermi="['archive:lxjs:updateBgqx']">修改保管期限</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V' && categoryType == '3'">
                        <!-- v-hasPermi="['archive:lxjs:updateBgqx']" -->
                        <el-button type="primary" plain icon="el-icon-plus" @click="handleguidangJieshouTap(1)"
                            v-hasPermi="['archive:dgd:guidang']">归档</el-button>
                    </el-col>

                    <el-col :span="1.5" v-show="subStr == 'V'">
                        <el-button type="primary" plain icon="el-icon-printer" @click="printTap()"
                            v-hasPermi="['archive:dgd:folderMldy']">目录打印</el-button>
                        <el-button type="warning" plain icon="el-icon-printer" v-hasPermi="['archive:dgd:folderFileMldy']"
                            @click="printTap(1)">卷内目录打印</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V'">
                        <el-button type="danger" plain icon="el-icon-takeaway-box" v-hasPermi="['archive:dgd:fengmian']"
                            @click="printDyTap(0)">封面打印</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V'">
                        <el-button type="warning" plain icon="el-icon-printer" @click="printDyTap(2)"
                            v-hasPermi="['archive:dgd:heji']">打印盒脊</el-button>
                    </el-col>
                    <el-col :span="1.5">
                        <el-button type="info" plain icon="el-icon-download" @click="handleExport"
                            v-hasPermi="['archive:dgd:export']">导出</el-button>
                    </el-col>

                    <el-col :span="1.5">
                        <!--项目层的案卷导入-->
                        <!-- <el-button type="primary" plain icon="el-icon-upload2" v-show="subStr == 'X'"
                            @click="handleImportFolder" v-hasPermi="['archive:dgd:anjuandaoru1']">案卷导入</el-button> -->
                        <!--案卷层的案卷导入-->
                        <el-button type="primary" plain icon="el-icon-upload2" v-show="subStr == 'V'&&categoryType == '1'"
                            @click="handleImportFolder" v-hasPermi="['archive:dgd:anjuandaoru2']">案卷导入</el-button>
                    </el-col>
                    <el-col :span="1.5" v-show="subStr == 'V'&&categoryType == '1'">
                        <el-button type="primary" plain icon="el-icon-printer" @click="handleImportFile()"
                            v-hasPermi="['archive:dgd:juanneijiandaoru']">卷内件导入</el-button>
                    </el-col>
                      <el-col :span="1.5" v-if="subStr == 'X' && categoryType == '3'">
                        <el-button type="primary" plain icon="el-icon-plus"
                            @click="handleJieshouTap()" v-hasPermi="['archive:fileCollection:fileQrganizationTobeArchived:addgdsqd']">归档申请单</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'V' && categoryType == '1'">
                        <el-button type="primary" plain icon="el-icon-plus"
                            @click="handleJieshouTap()" v-hasPermi="['archive:fileCollection:fileQrganizationTobeArchived:addgdsqd']">归档申请单</el-button>
                    </el-col>
                    <el-col :span="1.5" v-if="subStr == 'F' && categoryType == '0'">
                        <el-button type="primary" plain icon="el-icon-plus"
                            @click="handleJieshouTap()" v-hasPermi="['archive:fileCollection:fileQrganizationTobeArchived:addgdsqd']">归档申请单</el-button>
                    </el-col>

                    <right-toolbar :showSearch.sync="showSearch" @queryTable="queryTableTap"></right-toolbar>
                </el-row>
                <tableList v-if="tableHeight" :tableHeaderList="tableHeaderList"
                    @handleSelectionChange="handleSelectionChange" :tableData="tableData" :loading="loading"
                    :tableHeight="tableHeight" @celldblclick="celldblclick" @sortChange="sortChange" ref="ref"
                    @handleFail="handleFail"></tableList>
                <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
                    :limit.sync="queryParams.pageSize" @pagination="getlistPost" />
            </el-col>
            <el-col :span="20" :xs="24" v-show="!isShow" class="empty">
                <el-empty :image-size="200"></el-empty>
            </el-col>

        </el-row>
        <!-- start 组件著录、修改 -->
        <jiandeit v-if="jianOpen" :open="jianOpen" :openInfo="openInfo" @closeDelDialog="closeDelDialog"
            @submitDetail="submitDetail" :isParams="7">
        </jiandeit>
        <!-- end  组件著录、修改-->



        <!-- start 组卷著录、修改 -->
        <juandeit v-if="juanOpen" :open="juanOpen" :openInfo="openInfo" @closeDelDialog="closeDelDialog"
            @submitDetail="submitDetail" :isParams="7" :isZUXIU="isZUXIU" :isShow="isShowButton"></juandeit>
        <!-- end  组卷著录、修改-->

        <!-- start 项目下面的卷列表修改 -->
        <projectJuanlistDeit v-if="projectJuanlistDeitOpen" :open="projectJuanlistDeitOpen" :celldbData="celldbData"
            @detailsHandleClose="detailsHandleClose" :openInfo="openInfo" :isParams="7" :isShow="isShowButton">
        </projectJuanlistDeit>
        <!-- end  项目下面的卷列表修改 -->

        <!-- start 项目著录  修改 -->
        <projectdeit v-if="projectOpen" :open="projectOpen" :openInfo="openInfo" @submitDetail="submitDetail"
            @closeDelDialog="closeDelDialog" :isParams="7"></projectdeit>
        <!-- end 项目著录、修改 -->

        <!--start  组件详情 -->
        <jianDetailsOpen v-if="jianDetailsOpen" :open="jianDetailsOpen" :celldbData="celldbData"
            @detailsHandleClose="detailsHandleClose" :isParams="7">
        </jianDetailsOpen>
        <!--end 组件详情 -->
        <!-- start 组卷\项目详情 -->
        <juanDetailsOpen v-if="juanDetailsOpen" :open="juanDetailsOpen" :celldbData="celldbData" module="preArchiving"
            :treeRowData="treeRowData" @detailsHandleClose="detailsHandleClose" :isParams="7"></juanDetailsOpen>
        <!-- end 组卷\项目详情 -->

        <!-- start  目录打印 -->
        <vPrint v-if="printOpen" :open="printOpen" @closeDelDialog="closeDelDialog" :tableHeaderList="tableHeaderList"
            :printList="printList"></vPrint>
        <!-- end  目录打印 -->

        <!--start 手动排档号 -->
        <manualNumber :number="number" @numberCancel="numberCancelTap" @submitNumberForm="submitNumberForm"></manualNumber>
        <!-- end  手动排档号 -->

        <!-- start  档号查缺 -->
        <LeakFilling :leak="leak" @leakCancel="leakCancel" ref="leakRef"></LeakFilling>
        <!-- end  档号查缺 -->

        <!-- start  修改保管期限 -->
        <deitBgqx v-if="openBgqx" :openBgqx="openBgqx" @bgqxCloseDelDialog="bgqxCloseDelDialog" @bgqxSubmit="bgqxSubmit">
        </deitBgqx>
        <!-- end  修改保管期限 -->
        <!-- start  检测方案弹窗 -->
        <el-dialog title="请选择检测方案" :visible.sync="dialogVisible" width="20%" :before-close="handlecloseDelDialog"
            :close-on-click-modal="false">
            <el-select v-model="sxjcType" placeholder="请选择" style="width:100%">
                <el-option v-for="item in sxjcList" :key="item.identification" :label="item.identification"
                    :value="item.identification">
                </el-option>
            </el-select>
            <span slot="footer" class="dialog-footer">
                <el-button type="primary" @click="handleYes">确 定</el-button>
            </span>
        </el-dialog>
        <!-- end  检测方案弹窗-->
        <FailList :open="failOpen" ref="failRef" @cancel="cancel"></FailList>

        <!-- 用户导入对话框 -->
        <dataImport :upload="upload" @uploadCancel="uploadCancelTap" @importTemplate="importTemplateTap"
            @uploadFile="uploadFile" @submitFileForm="submit"></dataImport>
        <!-- 导入匹配页 -->
        <importMatch :match="match" ref="matchRef" @matchCancel="matchCancelTap" @submitMatch="submitMatch"></importMatch>
    </div>
</template>
<script>

import FailList from "@/views/archive/fileCollection/fileOrganization/fileQrganizationTobeArchived/failList.vue"
import {
    getqueryfieldList,
    getlistbytreenodeList,
    getthbytreenodeHeaderList,
    deleteData,
    supervisionDa, getTitle,
    geturl, updateBgqx, getbkbdata, uploadList
} from "@/api/archive/fileCollection/offlinReception.js";
import { jieshou } from "@/api/archive/digitalizeReceive/archiveReception.js";
import {
    cancelAccept,
    pieceNumber,
    clearNumber,
    getLastZlx,
    insertPieceNumber,
    assemblyFolderVerifyygd,
    ygdtuihui,
    daIdsDetection,
    dgdJieshou,
    getDetail
} from "@/api/archive/fileCollection/fileOrganization.js"
import queryCriteriaList from "@/components/queryCriteriaList/index.vue"  //查询列表
import fileTrees from "@/components/fileTrees/index.vue"  //档案树
import { getGroupTree } from "@/api/archive/archivesCategory.js"
import tableList from "@/components/tableList/index.vue"
// import jiandeit from "@/views/archive/fileCollection/fileOrganization/fileQrganizationTobeArchived/jiandeit.vue" //件添加修改弹窗
import jiandeit from "@/views/archive/fileCollection/offlinReception/jiandeit.vue" //件添加修改弹窗
// import juandeit from "@/views/archive/fileCollection/fileOrganization/fileQrganizationTobeArchived/juandeit" //卷添加修改弹窗
import juandeit from "@/views/archive/fileCollection/offlinReception/juandeit.vue" //卷添加修改弹窗
// import projectJuanlistDeit from "@/views/archive/fileCollection/fileOrganization/fileQrganizationTobeArchived/projectJuanlistDeit.vue" //项目下面的卷列表修改
import projectJuanlistDeit from "@/views/archive/fileCollection/offlinReception/projectJuanlistDeit.vue" //项目下面的卷列表修改
import projectdeit from "@/views/archive/fileCollection/offlinReception/projectdeit.vue" //卷添加修改弹窗
import treeHeight from '@/mixins/treeHeight'//计算左侧树的高度
import jianDetailsOpen from '@/components/componentsJianDetails/index.vue' //件详情
import juanDetailsOpen from '@/components/componentsJuanDetails/index.vue' //卷详情
import dataImport from "@/components/dataImportComponent/dataImport.vue"; //案卷导入，卷内件导入
import importMatch from "@/components/dataImportComponent/importMatch.vue";
import vPrint from "@/components/printComponent/index.vue" //目录打印弹窗模板
import { getLastIndexOf } from "@/utils/index.js"
import ManualNumber from "@/views/archive/digitalizeReceive/archiveReception/manualNumber"; //手动拍档号
import LeakFilling from "@/views/archive/fileCollection/fileOrganization/fileQrganizationTobeArchived/leakFilling"; // 档号查缺
import deitBgqx from "@/views/archive/fileCollection/fileOrganization/fileQrganizationTobeArchived/deitBgqx.vue"  //修改保管期限
import { getdetectionSchemeList } from '@/api/archive/archiveTransfer/archiveTransfer.js'
import { getmultipleInfo } from "@/api/archive/filesManage/filesManageMenu";
import { getTypeObject } from "@/api/archive/dict/dictManageData";
import { addArchiveFormSave} from "@/api/archive/fileCollection/fileOrganization.js"
export default {
    mixins: [treeHeight], // 混入方法
    components: {
        LeakFilling,
        queryCriteriaList,
        fileTrees,
        jiandeit,
        juandeit,
        tableList,
        projectdeit,
        jianDetailsOpen,
        juanDetailsOpen,
        vPrint,
        ManualNumber,
        deitBgqx,
        FailList,
        projectJuanlistDeit,
        dataImport,
        importMatch
    },

    data() {
        return {
            isnoClick: true,
            scroll: "",
            loading: false,
            // 显示搜索条件
            showSearch: true,
            listFrom: [], //查询框列表
            isShow: false, //是否显示右侧数据
            categoryinfo: "", //档案门类回显信息
            total: 0,
            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
            },
            tableHeaderList: [], //table表头数据
            tableData: [],//table列表数据
            jianOpen: false, //组件打开关闭
            juanOpen: false, //组卷打开关闭
            projectOpen: false,//项目打开关闭
            jianDetailsOpen: false,//件详情弹窗
            juanDetailsOpen: false,//卷详情弹窗
            printOpen: false,//目录打印弹窗
            openInfo: { //件 卷  项目
                opens: false,
                categoryId: undefined,
                menuId: undefined,
                type: undefined
            },
            tableHeight: "",
            ids: undefined,
            single: "",
            multiple: true,
            rowList: "", //当前点击的数据
            subStr: "",  //获取点击当前树的 件 卷  项目 截取 sub_table_name显示
            printOpen: false, //打印弹出传
            printList: [],
            // 手动排档号
            number: {
                // 是否显示弹出层
                open: false,
                // 弹出层标题
                title: ""
            },
            // 用户导入参数
            upload: {
                // 是否显示弹出层（用户导入）
                open: false,
                // 弹出层标题（用户导入）
                title: "",
            },
            // 导入文件类型  件、卷、项目
            uploadType: null,
            // 表格表头
            xlsTitle: [],
            // 可导入项
            sysTitle: [],
            // 匹配参数
            match: {
                // 是否显示弹出层
                open: false,
                // 弹出层标题
                title: "",
            },
            categoryType: "",
            menuId: '',
            // 档号查缺
            leak: {
                // 是否显示弹出层
                open: false,
            },
            treeRowData: {},
            openBgqx: false, //修改保管期限弹窗
            dialogVisible: false, //检测方案弹窗
            sxjcList: [],//四性检测方案列表数据
            sxjcType: undefined,
            failOpen: false,
            thisFail: [],
            menuType: '',
            daType: null,
            projectJuanlistDeitOpen: false,//项目下面的卷列表修改
            isShowButton: true,
            responselist: "",//门类详情
            isZUXIU:""
        }
    },

    created() {
        this.menuId = this.$route.meta.menuId
    },


    methods: {
        // 案卷导入
        handleImportFolder() {
            if (this.subStr == 'X') {
                if (this.ids == undefined) {
                    this.$message({ message: '请选择先选择数据哦', type: 'warning' })
                    return false
                }
                if (this.single) {
                    this.$message({ message: '请选择一条数据哦', type: 'warning' })
                    return false
                }
            }
            // console.log("案卷导入")
            this.upload.title = "案卷数据";
            this.upload.open = true;
            this.uploadType = 1
        },
        //给组卷 卷内件导入
        handleImportFile() {
            if (this.ids == undefined) {
                this.$message({ message: '请选择先选择数据哦', type: 'warning' })
                return false
            }
            if (this.single) {
                this.$message({ message: '请选择一条数据哦', type: 'warning' })
                return false
            }
            // console.log("件导入")
            this.upload.title = "卷内件数据";
            this.upload.open = true;
            this.uploadType = 0
        },
        // 关闭导入  /件/卷/项目
        uploadCancelTap() {
            this.upload.open = false;
            this.getlistHeaderPost();
        },
        // 下载模板
        importTemplateTap() {
            this.form = {
                type: this.uploadType,
                categoryId: this.queryParams.categoryId
            }
            if (this.uploadType == 0) {
                // console.log("卷内件下载模板")
                this.download('/archive/daImport/download?type=' + this.uploadType + "&categoryId=" + this.queryParams.categoryId, {
                }, `fileData_template_${new Date().getTime()}.xlsx`)
            } else if (this.uploadType == 1) {
                // console.log("案卷下载模板")
                this.download('/archive/daImport/download?type=' + this.uploadType + "&categoryId=" + this.queryParams.categoryId, {
                }, `folderData_template_${new Date().getTime()}.xlsx`)
            } else {
                // console.log("项目下载模板")
                this.download('/archive/daImport/download?type=' + this.uploadType + "&categoryId=" + this.queryParams.categoryId, {
                }, `itemData_template_${new Date().getTime()}.xlsx`)
            }
        },
        // 上传文件
        uploadFile(concent) {
            this.file = concent.file
            const formData = new FormData();
            formData.append("file", concent.file);
            formData.append("categoryId", this.queryParams.categoryId);
            formData.append("type", this.uploadType);
            getTitle(formData).then(response => {
                this.xlsTitle = response.data.xlsTitle.map(item => {
                    return {
                        xlsNum: item.num,
                        xlsName: item.name
                    }
                })
                this.sysTitle = response.data.sysTitle.map(item => {
                    return {
                        name: item.fieldName,
                        caption: item.fieldCaption,
                        showType: item.showType,
                        dataLength: item.dataLength,
                        isNoEmpty: item.isNoEmpty,
                        defaultValue: item.defaultValue,
                        checkChongfu: item.checkChongfu
                    }
                })
                this.$nextTick(() => {   //此函数执行时所有的DOM挂载和渲染都已完成
                    console.log(this.$refs.matchRef, "------------------------")
                    this.$refs.matchRef.init(this.xlsTitle, this.sysTitle);     //获取子组件中init方法并将父组件数据传递给子组件
                });
            })
        },

        // 点击确认
        submit() {
            // console.log("打开匹配页")
            this.upload.open = false
            this.match.open = true
            if (this.uploadType == 0) {
                this.match.title = "卷内件导入"
            } else if (this.uploadType == 1) {
                this.match.title = "案卷导入"
            } else {
                this.match.title = "项目导入"
            }
            // this.$nextTick(() => {   //此函数执行时所有的DOM挂载和渲染都已完成
            //     this.$refs.matchRef.init(this.xlsTitle, this.sysTitle);     //获取子组件中init方法并将父组件数据传递给子组件
            // });
        },
        submitMatch(matchedData) {
            this.form = {
                categoryId: this.queryParams.categoryId,
                state: this.queryParams.state,
                jsType: 0,
                colNames: matchedData
            }
            if (this.subStr == "F") {
                this.form.type = this.uploadType
                // if (this.uploadType == 0) {
                //     this.form.type = this.uploadType
                //     this.form.folderId = "-1"
                // } else {
                //     this.form.type = this.uploadType
                // }
            } else if (this.subStr == "V") {
                if (this.uploadType == 0) {
                    this.form.type = 0
                    this.form.folderId = this.ids
                } else {
                    this.form.type = this.uploadType
                }
            } else {
                if (this.uploadType == 1) {
                    this.form.type = 1
                    this.form.itemId = this.ids
                } else {
                    this.form.type = this.uploadType
                }
            }
            const formData = new FormData();
            formData.append("file", this.file);
            formData.append("dataStr", JSON.stringify(this.form));
            uploadList(formData).then(response => {
                this.$modal.msgSuccess(response.msg);
                // this.match.open = false;
                this.getlistPost()
            })
            this.match.open = false;
        },
        matchCancelTap() {
            this.match.open = false;
        },


        handleFail(val) {
            this.failOpen = true
            this.$nextTick(() => {
                this.$refs.failRef.init(val)
            })
        },
        cancel() {
            this.failOpen = false
        },
        //动态设置table的高度
        tableHeightData() {
            this.$nextTick(
                () => {
                    let h = document.documentElement.clientHeight
                    //     console.log(this.$refs.queryForm.$el.offsetHeight, this.$refs.refbut.$el.offsetHeight, "sdklfjklliuhaiorng")
                    h = h - 200
                    if (this.$refs.queryForm) { // 页面上如果有面包屑区域徐减去它的高度
                        h = h - this.$refs.queryForm.$el.offsetHeight
                    }

                    if (this.$refs.refbut) { // 页面上如果有分页区域徐减去它的高度
                        h = h - this.$refs.refbut.$el.offsetHeight
                    }
                    // console.log(h,"sdjfdklsjfkl")
                    this.tableHeight = h > 310 ? h : 310 // 根据自己项目定高度
                    return h
                }
            )

        },
        // 树节点单击事件
        onTreeClick(data) {
            // console.log(data,"+++")
            this.isnoClick = false;
            this.treeRowData = data;
            if (data.categoryId != null) {
                this.isShow = true
            } else {
                this.isShow = false
            }
            if (this.$refs.queryForm != undefined) {
                this.$refs.queryForm.queryParams = {};
            }
            if (data.nodeType == null || data.nodeType == "t" || data.nodeType == "f") {
                this.isnoClick = true;
                return false;
            }
            getGroupTree(data.categoryId).then(response => {
                this.categoryInfo = response.data
            });
            this.loading = true;
            this.queryParams = data;
            this.queryParams.state = 10;
            // this.queryParams.jsType = 1;
            this.queryParams.pageNum = 1;
            this.queryParams.pageSize = 10;
            this.queryParams.order = '';
            if (this.queryParams.sub_table_name != undefined) {
                this.subStr = getLastIndexOf(this.queryParams.sub_table_name);
                let stb = this.queryParams.sub_table_name;
                let stbArr = stb.split("_");
                this.categoryType = stbArr[stbArr.length - 3];
            } else {
                this.getGroupTreePost(data.categoryId);
            }
            this.getqueryfieldListPost();//点击树节点获取查询字段
            this.getlistHeaderPost();/**点击树节点,获取table表头数据 */
            if (this.$refs.ref != undefined) {
                this.$refs.ref.clearSort()
            }

        },


        //档案门类树门类根据categoryID回显
        getGroupTreePost(ID) {
            getGroupTree(ID).then(response => {
                if (response.data.type == "0") { //件
                    this.queryParams.sub_table_name = response.data.fileTableName;
                } else if (response.data.type == "1") { //卷
                    this.queryParams.sub_table_name = response.data.folderTableName;
                } else { //项目
                    this.queryParams.sub_table_name = response.data.itemTableName;
                }
                this.subStr = getLastIndexOf(this.queryParams.sub_table_name);
                let stb = this.queryParams.sub_table_name;
                let stbArr = stb.split("_");
                this.categoryType = stbArr[stbArr.length - 3];
            });
        },


        /** 点击树节点获取查询字段 */
        getqueryfieldListPost(data) {
            this.queryParams.searchcolumn = undefined
            getqueryfieldList({
                categoryId: this.queryParams.categoryId,
                menuId: this.queryParams.menuId,
                subTableName: this.queryParams.sub_table_name,

            }).then(response => {
                this.listFrom = response.rows;
            });
        },
        /**点击树节点,获取table表头数据 */
        getlistHeaderPost() {
            getthbytreenodeHeaderList({
                categoryId: this.queryParams.categoryId, menuId: this.queryParams.menuId, subTableName: this.queryParams.sub_table_name
            }
            ).then(response => {
                this.tableHeaderList = response.rows;
                var fields = []
                for (var i in response.rows) {
                    fields.push(response.rows[i].FIELD_NAME)
                }
                this.queryParams.fields = fields.toString()
                //获取指定字典列表
                var headerlist = [];
                for (var i = 0; i < this.tableHeaderList.length; i++) {
                    if (this.tableHeaderList[i].SHOWTYPE.toString().indexOf('5') != -1) {
                        this.tableHeaderList[i].SHOWTYPE = 5
                    }
                    if (this.tableHeaderList[i].SHOWTYPE == 5) {
                        headerlist.push(this.tableHeaderList[i].FIELD_NAME)
                    }
                }
                if (headerlist.length > 0) {
                    getTypeObject(headerlist).then((res) => {
                        this.dictList = res.data;
                    })
                }
                this.getlistPost();
                this.isnoClick = true;
            });
        },
        /** 点击树节点,获取table数据*/
        getlistPost() {
            if (this.queryParams.fields==''){
              this.$message({ message: '请先对该门类进行配置！', type: 'warning' })
              return ;
            }
            getlistbytreenodeList(this.queryParams).then(response => {
                this.tableData = response.rows;
                this.total = response.total;
                this.loading = false;
                // console.log(this.tableData, '___')
                this.tableHeightData();
            });
        },

        //是否选择数据
        handleSelectionChange(ids, single, multiple) {
            this.ids = ids.toString();
            this.single = single;
            this.multiple = multiple;
        },
        //保管期限修改
        deitBGQXTap() {
            console.log(this.ids, this.multiple, this.single)
            if (!this.multiple) {

                this.openBgqx = true
            } else {
                this.$message({ message: '请选择要修改的数据哦', type: 'warning' })

            }
        },

        //提交保管期限修改
        bgqxSubmit(val) {
            console.log(val, "+++++++++++++++++++++++++++")
            if (val) {
                updateBgqx({
                    bgqxVal: val,
                    categoryId: this.queryParams.categoryId,
                    type: this.subStr,
                    ids: this.ids
                }).then(res => {
                    console.log(res, "+++++++++++++++++++")
                    if (res.code == "200") {
                        this.$modal.msgSuccess("修改成功");
                        this.openBgqx = false;
                        this.getlistPost();
                    }
                })
            } else {
                this.$message({ message: '请选择保管期限', type: 'warning' })

            }
        },

        //关闭保管期限修改
        bgqxCloseDelDialog() {
            this.openBgqx = false
        },
        //表单重置
        resetQuery() {
            this.queryParams.searchcolumn = undefined
            this.queryParams.order = undefined;
            this.getlistPost();
            this.$refs.ref.clearSort()
        },
        //点击搜索
        handleQuery(searchcolumn) {

            var column = searchcolumn.filter(item => { return item.value !== '' && item.value !== null })
            this.queryParams.searchcolumn = column
            this.queryParams.order = undefined;
            this.getlistPost();
            this.$refs.ref.clearSort()
        },
        //刷新页面
        queryTableTap() {
            this.queryParams.order = undefined;
            this.getlistPost();
            this.$refs.ref.clearSort()
        },

        //件  this.jianOpen  著录和修改     //组卷 this.juanOpen 著录和修改    //项目 this.projectdOpen 著录和修改
        handledeitTap(e) {

            this.openInfo = {
                opens: true,
                categoryId: this.queryParams.categoryId,
                menuId: this.queryParams.menuId,
                folderId: undefined, //组卷id
                itemId: undefined, //项目Id
                subTableName: this.queryParams.sub_table_name,
                nodeType: this.queryParams.nodeType,
                parentNodeType: this.queryParams.parentNodeType,
                parentSubTableName: this.queryParams.parentSubTableName,
                subStr: this.subStr,

            }
            if (e == 1) {  //修改
                if (this.ids == undefined) {
                    this.$message({ message: '请选择要修改的数据哦', type: 'warning' })
                    return false
                }
                if (this.single) {
                    this.$message({ message: '请选择一条要修改的数据哦', type: 'warning' })
                    return false
                }

                this.openInfo.ids = this.ids; //组件Id;
            } else { //添加
                this.openInfo.ids = undefined
            }
            if (this.subStr == "F") {  //F 件
                this.openInfo.type = 0
                this.jianOpen = true
            } else if (this.subStr == "V") { //卷
                this.openInfo.type = 1
                this.juanOpen = true;
            } else { //项目
                this.openInfo.type = 3
                this.projectOpen = true;
            }
            var row = this.tableData.filter(item => { return this.ids == item.ID })

            this.openInfo['IS_DATA_MIGRATION'] =row[0].IS_DATA_MIGRATION; // 是否迁移数据  ,中铁需求，判断如果是迁移数据不校验关联关系
        },
        //给项目案卷著录
        handledeitanJuanTap() {
            this.isZUXIU = "1" //判断项目下的案卷是著录还是修改
            if (this.ids == undefined) {
                this.$message({ message: '请选择先选择数据哦', type: 'warning' })
                return false
            }
            if (this.single) {
                this.$message({ message: '请选择一条数据哦', type: 'warning' })
                return false
            }
            var row = this.tableData.filter(item => { return this.ids == item.ID })

            this.openInfo = {
                opens: true,
                categoryId: this.queryParams.categoryId,
                menuId: this.queryParams.menuId,
                type: 1, //传卷类型  0,组件 1，组卷 3，项目
                folderId: undefined, //组卷id
                itemId: this.ids, //项目Id
                subTableName: this.queryParams.sub_table_name,
                subStr: this.subStr,
                label: row[0].XMMC,
                IS_DATA_MIGRATION:row[0].IS_DATA_MIGRATION, // 是否迁移数据  ,中铁需求，判断如果是迁移数据不校验关联关系
            }
            this.openInfo.itemId = this.ids; //项目Id;
            this.juanOpen = true;
        },
        //修改项目下面的案卷
        handledeitanDeitJuanTap() {
            var that = this;
            this.isZUXIU = "2" //判断项目下的案卷是著录还是修改
            if (this.ids == undefined) {
                this.$message({ message: '请选择先选择数据哦', type: 'warning' })
                return false
            }
            if (this.single) {
                this.$message({ message: '请选择一条数据哦', type: 'warning' })
                return false
            }
            var row = this.tableData.filter(item => { return this.ids == item.ID })
            var level = "";
            if (getLastIndexOf(this.queryParams.sub_table_name) == "F") {  //F 件
                level = 0
            } else if (getLastIndexOf(this.queryParams.sub_table_name) == "V") { //卷
                level = 1
            } else { //项目
                level = 3
            }
            this.openInfo = {
                opens: true,
                categoryId: this.queryParams.categoryId,
                menuId: this.queryParams.menuId,
                folderId: undefined, //组卷id
                itemId: this.ids, //项目Id
                subTableName: this.responselist.fileTableName,
                nodeType: "l",
                subStr: "V",
                type: 1
            }
            this.celldbData = {
                id: row[0].ID,
                categoryId: this.queryParams.categoryId,
                menuId: this.queryParams.menuId,
                sub_table_name: this.queryParams.sub_table_name,
                label: row[0].XMMC,
                level: level,
                ifSub_table_name: this.queryParams.sub_table_name,
                isDel: "0",  //判断是回收站数据还是接收收据 isDel:1  回收站    isDel:0 //离线接收、档案接收、在线接收
            }
            that.projectJuanlistDeitOpen = true
        },
        //退回
        tuihuiTap() {
            if (this.ids != undefined && !this.multiple) {
                ygdtuihui({
                    categoryId: this.queryParams.categoryId,
                    ids: this.ids
                }).then(res => {
                    if (res.code = "200") {
                        this.$modal.msgSuccess("退回成功");
                        this.getlistPost();
                    }

                })
            } else {
                this.$message({ message: '请选择退回的数据哦', type: 'warning' })
                return false
            }
        },
        //关闭著录 \件\ 组卷
        closeDelDialog() {
            this.jianOpen = false //件
            this.juanOpen = false //卷
            this.projectOpen = false; //项目
            this.printOpen = false;//目录打印
            this.openInfo = ""
        },

        //著录成功
        submitDetail() {
            console.log(")))))))))))))))))))")
            this.jianOpen = false;
            this.juanOpen = false //卷
            this.projectOpen = false; //项目
            this.getlistHeaderPost();
        },

        //删除
        handleDeleteTap() {
            if (this.ids != undefined && !this.multiple) {
                this.$modal.confirm('是否确认删除所选数据项？').then((res) => {
                    let type = "";
                    if (this.subStr == "F") {  //F 件
                        type = 0;
                    } else if (this.subStr == "V") { //卷
                        type = 1;
                    } else { //项目
                        type = 3;
                    }
                    deleteData({
                        //nodeType: this.queryParams.nodeType,
                        categoryId: this.queryParams.categoryId,
                        type: type,
                        //sub_table_name: this.queryParams.sub_table_name,
                        //menuId: this.queryParams.menuId,
                        //parentNodeType: this.queryParams.parentNodeType,
                        //parentSubTableName: this.queryParams.parentSubTableName,
                        ids: this.ids
                    }).then(res => {
                        if (res.code == "200") {
                            this.$modal.msgSuccess("删除成功");
                            this.getlistPost();

                        }
                    })

                }).catch(() => { });
            } else {
                this.$message({ message: '请选择要删除的数据哦', type: 'warning' })
            }
        },

        //取消接收
        handleQuXiaoJieshouTap() {
            if (this.ids != undefined && !this.multiple) {
                this.$modal.confirm('是否确认取消接收所选数据项？').then(function () {
                }).then(() => {
                    cancelAccept({
                        categoryId: this.queryParams.categoryId,
                        ids: this.ids
                    }).then(res => {
                        this.getlistPost();
                        this.$modal.msgSuccess("取消成功");
                        // setTimeout(res => {
                        //     this.$router.push({ path: "/archive/fileCollection/fileOrganization" })
                        // }, 1000)
                    })

                }).catch(() => { });
            } else {
                this.$message({ message: '请选择要取消接收的数据哦', type: 'warning' })
            }
        },
        //双击列表进入详情页面
        celldblclick(row) {
            var level = "";
            var label = "";
            if (getLastIndexOf(this.queryParams.sub_table_name) == "F") {  //F 件
                level = 0
                label = row.TITLE;
            } else if (getLastIndexOf(this.queryParams.sub_table_name) == "V") { //卷
                level = 1
                label = row.TITLE;
            } else { //项目
                level = 3
                label = row.XMMC;

            }
            this.celldbData = {
                id: row.ID,
                categoryId: this.queryParams.categoryId,
                menuId: this.queryParams.menuId,
                sub_table_name: this.queryParams.sub_table_name,
                label: label,
                level: level,
                ifSub_table_name: this.queryParams.sub_table_name,
                isDel: "0",  //判断是回收站数据还是接收收据 isDel:1  回收站    isDel:0 //离线接收、档案接收、在线接收
                tableHeaderList: this.tableHeaderList
            }
            this.$nextTick(() => {
                if (this.subStr == "F") {  //F 进入件详情
                    this.jianDetailsOpen = true;
                } else { //进入卷详情 和项目详情
                    this.juanDetailsOpen = true
                }
            })

        },
        //关闭详情页面
        detailsHandleClose() {
            this.jianDetailsOpen = false;
            this.juanDetailsOpen = false;
            this.projectJuanlistDeitOpen = false;
        },

        //排序
        sortChange(val) {
            // console.log(val, "ksdfjkl")
            this.queryParams.order = val;
            // console.log(this.queryParams, "+++")
            this.getlistPost();
        },
        //归档接收
        handleguidangJieshouTap(e) {
            // console.log(this.ids)
            console.log(e, e == '0', e == '1')
            if (this.ids != undefined && !this.multiple) {

                // this.$modal.confirm('是否确认接收所选数据数据项？').then(function () {
                // }).then(() => {
                //     jieshou({
                //         categoryId: this.queryParams.categoryId,
                //         ids: this.ids
                //     }).then(res => {
                //         this.getlistPost();
                //         this.$modal.msgSuccess("接收成功");
                //         setTimeout(res => {
                //             // this.$router.push({ path: "/archive/fileCollection/fileOrganization" })
                //         }, 1000)
                //     })

                // }).catch(() => { });
                if (this.subStr == 'X') {
                    this.daType = 3
                } else if (this.subStr == 'V') {
                    this.daType = 1
                } else if (this.subStr == 'F') {
                    this.daType = 0
                }
                if (e == '0') {
                    this.menuType = '0'
                } else {
                    this.menuType = '1'
                }
                this.getdetectionSchemeListPOST();
            } else {
                this.$message({ message: '请选择要接收的数据哦', type: 'warning' })
            }
        },
         //添加归档审批单
        handleJieshouTap() {
            var dataParams = [];
            if (this.ids != undefined && !this.multiple) {
                var idsData = this.ids.split(",");
                for (var i in idsData) {
                    dataParams.push({
                        archiveId: idsData[i],
                        categoryId: this.queryParams.categoryId,
                        daType: this.subStr,
                        state: "0",
                        subTableName: this.queryParams.sub_table_name
                    })
                }
                this.$modal.confirm('是否确认添加所选数据项到归档申请单？').then(() => {
                    addArchiveFormSave(dataParams).then(res => {
                        if (res.code == "200") {
                            this.$modal.msgSuccess("申请成功");
                            this.getlistPost();

                        } else {
                            this.$modal.msgSuccess(res.msg);

                        }

                    }).catch(res => {
                        this.getlistPost();
                    })

                }).catch(() => { });
            } else {
                this.$message({ message: '请选择要申请的归档单的数据哦', type: 'warning' })
            }
        },

        /**四性检测方案列表 */
        getdetectionSchemeListPOST() {
            getdetectionSchemeList({
                state: "1",
                phase: "0",
                categoryId: this.queryParams.categoryId,
                menuType: this.menuType,
                daType: this.daType,
            }).then(res => {
                if (res.rows.length > 0) {
                    this.sxjcList = res.rows
                    this.dialogVisible = true;
                } else {
                    this.$message({ message: '当前门类数据还没有四性检测方案数据', type: 'warning' })
                }
            })
        },

        //选择检测方案
        handleYes() {
            if (this.sxjcType == undefined) {
                this.$message({ message: '请选择方案', type: 'warning' })
                return false
            }
            var dataArr = {
                "categoryId": this.queryParams.categoryId,
                "link": "0",
                "code": this.sxjcType,
                "daIds": this.ids,
                "menuType": this.menuType,
                "daType": this.daType
            }
            this.$modal.loading("正在检测中...");
            this.dialogVisible = false;
            if (this.menuType == '0') {
                daIdsDetection(dataArr).then(res => {
                    if (res.code == "200") {
                        console.log(res)
                        if (res.data.daId.length > 0) {
                            this.$message({ message: '检测已完成,有' + res.data.daId.length + '条不通过', type: 'success' })
                        } else {
                            this.$message({ message: '检测已完成', type: 'success' })
                        }
                        this.sxjcType = undefined;
                        this.getlistHeaderPost();
                        this.$modal.closeLoading();
                    }
                }).catch(res => {
                    this.sxjcType = undefined;
                    this.getlistHeaderPost();
                    this.$modal.closeLoading();
                })
            } else {
                dgdJieshou(dataArr).then(res => {
                    if (res.code == "200") {
                        console.log(res)
                        if (res.data.daId.length > 0) {
                            this.$message({ message: '检测已完成,有' + res.data.daId.length + '条不通过', type: 'success' })
                        } else {
                            this.$message({ message: '检测已完成', type: 'success' })
                        }
                        this.sxjcType = undefined;
                        this.getlistHeaderPost();
                        this.$modal.closeLoading();
                    }
                }).catch(res => {
                    this.sxjcType = undefined;
                    this.getlistHeaderPost();
                    this.$modal.closeLoading();
                })
            }

        },
        // 排卷号/排件号
        rowNumber() {
            if (this.ids == undefined || this.ids.length == 0) {
                this.$message({ message: '请选择需要排档号的数据', type: 'warning' })
                return false
            }
            this.form = {
                categoryId: this.queryParams.categoryId,
                sub_table_name: this.queryParams.sub_table_name
            }
            this.form.ids = this.ids
            if (this.subStr == "F") {  //F 件
                this.form.type = 0
            } else if (this.subStr == "V") { //卷
                this.form.type = 1
            } else { //项目
                this.form.type = 3
            }
            this.loading = true;
            pieceNumber(this.form).then(response => {
                this.getlistPost()
                this.loading = false;
                this.$modal.msgSuccess('排档号成功')
            }).catch(response => {
                this.getlistPost();
                this.loading = false;
            });
        },
        // 清空卷/件号
        cleanUp() {
            if (this.ids == undefined || this.ids.length == 0) {
                this.$message({ message: '请选择需要清空档号的数据', type: 'warning' })
                return false
            }
            this.form = {
                categoryId: this.queryParams.categoryId,
                sub_table_name: this.queryParams.sub_table_name
            }
            this.form.ids = this.ids
            if (this.subStr == "F") {  //F 件
                this.form.type = 0
            } else if (this.subStr == "V") { //卷
                this.form.type = 1
            } else { //项目
                this.form.type = 3
            }
            this.loading = true;
            clearNumber(this.form).then(response => {
                this.getlistPost()
                this.loading = false;
                this.$modal.msgSuccess('清空档号成功')
            }).catch(error => {
                this.loading = false;
            });
        },
        // 手动排档号
        manualNumber() {
            if (this.ids == undefined || this.ids.length == 0) {
                this.$message({ message: '请选择要手动排档号数据哦', type: 'warning' })
                return false
            }
            if (this.single) {
                this.$message({ message: '请选择一条要手动排档号的数据哦', type: 'warning' })
                return false
            }
            this.form = {
                categoryId: this.queryParams.categoryId,
                sub_table_name: this.queryParams.sub_table_name
            }
            this.form.ids = this.ids
            if (this.subStr == "F") {  //F 件
                this.form.type = 0
            } else if (this.subStr == "V") { //卷
                this.form.type = 1
            } else { //项目
                this.form.type = 3
            }
            getLastZlx(this.form).then(response => {
                this.number.title = response.data.fieldCaption
                this.number.open = true;
                this.number.info = response.data
            })
        },
        // 关闭手动排档号
        numberCancelTap() {
            this.number.open = false;
            this.getlistHeaderPost()
        },
        // 保存手动排档号
        submitNumberForm(form) {
            this.form = {
                categoryId: this.queryParams.categoryId,
                sub_table_name: this.queryParams.sub_table_name,
                ids: this.ids,
                ruleId: form.ruleId,
                buling: form.buling,
            }
            if (this.subStr == "F") {  //F 件
                this.form.type = 0
            } else if (this.subStr == "V") { //卷
                this.form.type = 1
            } else { //项目
                this.form.type = 3
            }
            var key = form.key;
            var value = form.value;
            // 动态追加键值对
            this.form[key] = value;
            insertPieceNumber(this.form).then(response => {
                this.getlistPost()
                this.number.open = false;
                this.$modal.msgSuccess('手动排档号成功')
            })
        },

        // 添加到指导单
        handleGuidanceTap() {
            if (this.ids == undefined || this.ids.length == 0) {
                this.$message({ message: '请选择要添加到指导单数据哦', type: 'warning' })
                return false
            }
            var type = ''
            if (this.subStr == "F") {  //F 件
                type = 0
            } else if (this.subStr == "V") { //卷
                type = 1
            }
            this.form = []
            var idsData = this.ids.split(",");
            for (var i in idsData) {
                this.form.push({
                    daId: idsData[i],
                    subTableName: this.queryParams.sub_table_name,
                    categoryId: this.queryParams.categoryId,
                    source: '0',
                    type: type
                })
            }
            supervisionDa(this.form).then(response => {
                this.getlistPost()
                this.$modal.msgSuccess('添加成功')
            })
        },

        //导出
        handleExport() {
            let type = "";
            if (this.subStr == "F") {  //F 件
                type = 0
            } else if (this.subStr == "V") { //卷
                type = 1
            } else { //项目
                type = 3
            }
            var data = {
                state: this.queryParams.state,
                categoryId: this.queryParams.categoryId,
                subTableName: this.queryParams.sub_table_name,
                menuId: this.queryParams.menuId,
                propertyName: this.queryParams.propertyName,
                propertyValue: this.queryParams.propertyValue,
                order: this.queryParams.order,
                ids: this.ids,
                searchcolumn: this.queryParams.searchcolumn,
                type: type
            }
            data = JSON.stringify(data);
            let dataParams = {
                data1: data,
                pageSize: this.queryParams.pageSize,
                pageNum: this.queryParams.pageNum
            }
            this.download('/archive/dgd/export', {
                ...dataParams
            }, `dgd_${new Date().getTime()}.xlsx`)
        },

        //组卷 合并卷
        mergeYqdaTap(val) {
            if (this.ids != undefined && !this.multiple) {
                if (val == 2) {
                    assemblyFolderVerifyygd({
                        categoryId: this.queryParams.categoryId,
                        folderIds: this.ids
                    }).then(res => {
                        this.openInfo = {
                            opens: true,
                            categoryId: this.queryParams.categoryId,
                            menuId: this.queryParams.menuId,
                            folderId: undefined, //组卷id
                            itemId: undefined, //项目Id
                            subTableName: this.queryParams.sub_table_name,
                            nodeType: this.queryParams.nodeType,
                            parentNodeType: this.queryParams.parentNodeType,
                            parentSubTableName: this.queryParams.parentSubTableName,
                            subStr: this.subStr,
                            type: 1,
                            ids: this.ids,
                            isDisabled: val, //判断如果从组卷按钮和合并卷按钮进去带参isDisabled，只可以将件组成卷或者将多个卷里面的件合并，不可以在里面添加件
                            source: 'ygd'
                        }

                        this.juanOpen = true;
                    }).catch(res => {
                        // this.$message({ message:res.msg, type: 'warning' })
                    })
                }
            } else {
                this.$message({ message: '请选择要操作的数据哦', type: 'warning' })
            }
        },

        print1Tap() {
            var data = [];
            var datalist = ['data']
            this.printList = [];
            if (this.ids != undefined && !this.multiple) {
                var idsData = this.ids.split(",")
                for (var i in this.tableData) {
                    for (var j in idsData) {
                        if (this.tableData[i].ID == idsData[j]) {
                            this.printList.push(this.tableData[i])
                        }
                    }
                }
                data = [{ data: this.printList }];
                geturl({
                    categoryId: this.queryParams.categoryId,
                    menuId: this.queryParams.menuId,
                    type: getLastIndexOf(this.queryParams.sub_table_name),
                    data: JSON.stringify(data),
                    datalist: JSON.stringify(datalist),
                }).then(res => {
                    if (res.data.result == "fail") {
                        this.$message({ message: res.data.msg, type: 'warning' })
                    } else {
                        window.open(res.data.url);
                    }


                })
            } else {
                this.$message({ message: '请选择要打印的数据哦', type: 'warning' })
            }
        },
        handlecloseDelDialog() {
            this.sxjcType = undefined
            this.dialogVisible = false
        },
        // 档号查缺
        leakFilling() {
            this.leak.open = true
            this.$nextTick(() => {
                this.$refs.leakRef.init(this.treeRowData)
            })
        },
        leakCancel() {
            this.leak.open = false
        },


        //目录打印
        printTap(val) {
            var that = this;
            var data = [];

            if (this.ids != undefined && !this.multiple) {
                if (val == '1') {
                    var nowtype = ''
                    var needtype = ''
                    var sub_table_name = ''
                    if (getLastIndexOf(this.queryParams.sub_table_name) == "V") {
                        needtype = "f"
                        nowtype = 'v',
                            sub_table_name = this.categoryInfo.fileTableName
                    } else {
                        needtype = "v"
                        nowtype = 'x'
                        sub_table_name = this.categoryInfo.folderTableName
                    }
                    /**点击树节点,获取table表头数据 */
                    getthbytreenodeHeaderList({
                        categoryId: this.queryParams.categoryId,
                        menuId: this.queryParams.menuId,
                        subTableName: this.categoryInfo.fileTableName
                    }
                    ).then(response => {

                        var fields = []
                        for (var i in response.rows) {
                            fields.push(response.rows[i].FIELD_NAME)
                        }
                        /** 点击树节点,获取table数据*/
                        getmultipleInfo({
                           state: "10",
                            categoryId: this.queryParams.categoryId,
                            nowtype: nowtype,
                            needtype: needtype,
                            ids: this.ids.split(","),
                            fields: fields.toString(),
                            menuId: this.menuId
                        }).then(res => {
                            getlistbytreenodeList(this.queryParams).then(response => {
                                var printTableData = response.rows;
                                this.getPrintList(res.data, sub_table_name, val, printTableData)
                            });
                        })
                    });
                } else {
                    getlistbytreenodeList(this.queryParams).then(response => {
                        var printTableData = response.rows;
                        this.getPrintList(printTableData, this.queryParams.sub_table_name, val)
                    });
                }
            } else {
                this.$message({ message: '请选择要打印的数据哦', type: 'warning' })
            }
        },
        //处理好的打印数据方法
        getPrintList(printTableData, sub_table_name, val, data2) {
            var that = this;
            var data = [];
            this.printList = [];
            var idsData = this.ids.split(",")
            for (var i in this.tableHeaderList) {
                if (this.tableHeaderList[i].SHOWTYPE == 5) {
                    for (var j in printTableData) {
                        for (var x in this.dictList[this.tableHeaderList[i].FIELD_NAME]) {
                            if (printTableData[j][this.tableHeaderList[i].FIELD_NAME] == this.dictList[this.tableHeaderList[i].FIELD_NAME][x].dictValue) {
                                printTableData[j][this.tableHeaderList[i].FIELD_NAME] = this.dictList[this.tableHeaderList[i].FIELD_NAME][x].dictLabel
                            }
                        }
                    }
                }
            }
            if (val == 1) {
                var datalist = ['data1', 'data2']
                var printList = [];
                for (var c in data2) {
                    for (var k in idsData) {
                        if (data2[c].ID == idsData[k]) {
                            printList.push(data2[c])
                        }
                    }
                }
                data = [{ data: printTableData }, { data: printList }];
            } else {
                var printList = [];
                for (var c in printTableData) {
                    for (var k in idsData) {
                        if (printTableData[c].ID == idsData[k]) {
                            printList.push(printTableData[c])
                        }
                    }
                }
                data = [{ data: printList }];
                var datalist = ['data']
            }
            geturl({
                categoryId: this.queryParams.categoryId,
                menuId: this.queryParams.menuId,
                type: getLastIndexOf(sub_table_name),
                data: JSON.stringify(data),
                datalist: JSON.stringify(datalist)
            }).then(res => {
                if (res.data.result == "fail") {
                    this.$message({ message: res.data.msg, type: 'warning' })
                } else {
                    window.open(res.data.url);
                }


            })
        },
        //封面打印  备考表打印
        printDyTap(val) {
            var that = this;
            var data = [];
            var name = "";
            // if (this.ids != undefined && !this.multiple) {

            var nowtype = ''
            var needtype = ''
            var sub_table_name = ''
            if (this.ids != undefined && !this.multiple) {
                if (getLastIndexOf(this.queryParams.sub_table_name) == "F") {
                    sub_table_name = "F"
                } else {
                    sub_table_name = "V"
                }
                var datalist = ['data']
                if (val == 0) { //封面打印
                    getlistbytreenodeList(this.queryParams).then(response => {
                        var printTableData = response.rows;
                        var printList = [];
                        var idsData = this.ids.split(",")
                        for (var c in printTableData) {
                            for (var k in idsData) {
                                if (printTableData[c].ID == idsData[k]) {
                                    printList.push(printTableData[c])
                                }
                            }
                        }
                        data = [{ data: printList }];
                        name = "FM"
                        geturl({
                            menuId: this.queryParams.menuId,
                            type: sub_table_name,
                            data: JSON.stringify(data),
                            name: name,
                            datalist: JSON.stringify(datalist)
                        }).then(res => {

                            if (res.data.result == "fail") {
                                this.$message({ message: res.data.msg, type: 'warning' })
                            } else {
                                window.open(res.data.url);
                            }
                        })
                    });

                } else if (val == 1) {
                    name = "BKB"  //备考表打印
                    getbkbdata({
                        menuId: this.queryParams.menuId,
                        type: name,
                        categoryId: this.queryParams.categoryId
                    }).then(res => {
                        console.log(res, "+++++++++++++")
                        geturl({
                            categoryId: this.queryParams.categoryId,
                            menuId: this.queryParams.menuId,
                            type: name,
                            data: res.msg,
                            datalist: JSON.stringify(datalist)
                        }).then(res1 => {
                            if (res1.data.result == "fail") {
                                this.$message({ message: res1.data.msg, type: 'warning' })
                            } else {
                                window.open(res1.data.url);
                            }
                        })
                    }).catch(res => {

                    })
                } else if (val == 2) {
                    getlistbytreenodeList(this.queryParams).then(response => {
                        var printTableData = response.rows;
                        for (let i = 0; i < printTableData.length; i++) {
                            if (printTableData[i].TITLE != null && printTableData[i].TITLE != undefined) {
                                if (printTableData[i].TITLE.length > 40) {
                                    printTableData[i].TITLE = printTableData[i].TITLE.substring(0, 40)
                                }
                            }
                          //截取档号后四位
                          if (printTableData[i].DH != null && printTableData[i].DH != undefined) {
                            if (printTableData[i].DH.length > 0) {
                              printTableData[i].DH = printTableData[i].DH.substring(printTableData[i].DH.length-4)
                            }
                          }
                            if (printTableData[i].SJJD == undefined || printTableData[i].SJJD == null) {
                              printTableData[i].SJJD = ''
                            }
                            if (printTableData[i].ZY_CODE == undefined || printTableData[i].ZY_CODE == null) {
                              printTableData[i].ZY_CODE = ''
                            }
                          printTableData[i].SJJD_ZY_CODE = printTableData[i].SJJD + printTableData[i].ZY_CODE
                        }
                        var printList = [];
                        var idsData = this.ids.split(",")
                        for (var c in printTableData) {
                            for (var k in idsData) {
                                if (printTableData[c].ID == idsData[k]) {
                                    printList.push(printTableData[c])
                                }
                            }
                        }
                        data = [{ data: printList }];
                        name = "HJ"
                        geturl({
                            categoryId: this.queryParams.categoryId,
                            menuId: this.queryParams.menuId,
                            type: name,
                            data: JSON.stringify(data),
                            datalist: JSON.stringify(datalist)
                        }).then(res => {
                            if (res.data.result == "fail") {
                                this.$message({ message: res.data.msg, type: 'warning' })
                            } else {
                                window.open(res.data.url);
                            }
                        })
                    });
                }
            } else {
                this.$message({ message: '请选择要打印的数据哦', type: 'warning' })
            }
        },
    }
}
</script>
